import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
// 请求拦截器
axios.interceptors.request.use(function (config) {
  // 发送请求的相关逻辑
  // config:对象  与 axios.defaults 相当
  // 借助config配置token
  let token = window.sessionStorage.getItem('TOKEN')
  // 判断token存在再做配置
  if (token) {
    config.headers.TOKEN = token+""
  }
  return config
}, function (error) {
  // Do something with request error
  return Promise.reject(error)
})
axios.defaults.baseURL='/graduationdesign_war'
axios.defaults.withCredentials = true
Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.prototype.$axios = axios    //全局注册，使用方法为:this.$axios
Vue.prototype.$store = store 
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

